<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>工厂模式-简单</title>
</head>
<body>
<script>
//把所有的属性和方法写在一起
const UserFactory = function(name1, name2) {
	const obj = new Object();
	obj.name1 = name1;
	obj.name2 = name2;
	obj.sayHello1 = function() {
		console.log('hello1');
	};
	obj.sayHello2 = function() {
		console.log('hello2');
	};
	return obj;
};
const user1 = UserFactory('aa', 11);
const user2 = UserFactory('bb', 12);
const user3 = UserFactory('cc', 13);
console.log(user1);
console.log(user2);
console.log(user3);
</script>
</body>
</html>